package thisIsPKQ

import (
	"github.com/shopspring/decimal"
	"log"
	"strconv"
)

func OrderCount(lot1,lot2,lot3 ,price2 float64) string{
	lot1_0 := decimal.NewFromFloat(lot1)
	lot2_0 := decimal.NewFromFloat(lot2)
	lot3_0 :=  decimal.NewFromFloat(lot3)
	price2_0 :=decimal.NewFromFloat(price2)

	if lot1<lot2{
		lot_x:=lot1_0.Mul(price2_0)
		lot_x_float,_:= strconv.ParseFloat(lot_x.String(), 64)
		if lot_x_float<lot3{
			return lot1_0.String()
			log.Println("此次套利下单量为",lot1_0.String())
		}else {
			lot_2:=lot3_0.Div(price2_0)
			return lot_2.String()
			log.Println("此次套利下单量为",lot_2.String())
		}
	}else {
		lot_x:=lot2_0.Mul(price2_0)
		lot_x_float,_:= strconv.ParseFloat(lot_x.String(), 64)
		if lot_x_float<lot3 {
			return lot2_0.String()
			log.Println("此次套利下单量为",lot2_0.String())
		}else {
			lot_2:=lot3_0.Div(price2_0)
			return lot_2.String()
			log.Println("此次套利下单量为",lot_2.String())
		}
	}
	return ""
}
